define(function(require, exports, module){

	require('jquery');	

	exports.initFirstNav = function(title){
		$('#KG-firstNav').find('.js_'+title).addClass('active');
	};

	var ajaxRequest = function(opts){
		var wrong = opts.error || function(){};
		var success = opts.success || function(){};
		var req = {
			url : opts.url,
			type : opts.type,
			dataType : 'json',
			success : function(json){
				if(json.status == 200){
					success(json);
				}
				else{
					wrong(json);
				}
			},
			error : function(err){
				wrong(err);
			}

		};
		if(opts.data){
			req.data = opts.data;
		}
		$.ajax(req);
	};

	exports.ajaxGet = function(opts){
		var req = {
			url : opts.url,
			success : opts.success,
			error : opts.error || null
		};
		ajaxRequest(req);
	};

});